<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件绑定</title>
    <script>
        function f1(){
            console.log("这是一个静态绑定事件");
        }
        function f2(){
            console.log("我过来了");
        }
        function f3(){
            console.log("我溜走了");
        }
        function f4(){
            console.log("我按下了鼠标");
        }
        function f5(){
            console.log("我松开了鼠标")
        }
        function f6(){
            console.log("我点击了")
        }
    </script>
</head>
<body>
<a href="javascript:;" ondblclick="f1()">静态绑定</a><br>
<a href="javascript:;" id="a2">动态绑定</a><br>
<div style="width: 200px;height: 100px;background-color: red;" onmouseover="f2()" onmouseout="f3()"></div>
<input type="text" onmousedown="f4()" onmouseup="f5()" onclick="f6()">
<script>
    document.getElementById("a2").onclick = function(){
        console.log("这是动态绑定事件");
    }
</script>
</body>
</html>